import request from "@/utils/request";
import { AxiosPromise } from "axios";
import { ModelList, ModelAysn, ModelStatus, ModelLimit } from "./types";

// 分销商剧目管理 - 获取列表分页查询
export function searchOperas(data: ModelList): AxiosPromise<Array<any>> {
  return request({
    url: `/api/operation/Operas/configs/search`,
    method: "post",
    data,
  });
}

// 分销商剧目管理 - 获取未授权的剧目列表
export function searchUnauthorized(data: ModelList) {
  return request({
    url: `/api/operation/Operas/agent/unauthorized/search`,
    method: "post",
    data,
  });
}

// 分销商剧目管理 - 同步剧目到其他分销商
export function aysnOperas(data: ModelAysn) {
  return request({
    url: `/api/operation/Operas/configs/push`,
    method: "post",
    data,
  });
}

// 分销商管理 - 剧目管理- 设置剧目启用状态
export function configShowStatus(data: ModelStatus): AxiosPromise<any> {
  return request({
    url: `/api/operation/operas/configs/${data.id}/show_status`,
    method: "patch",
    params: { showStatus: data.showStatus },
  });
}

// 分销商管理 - 剧目管理- 设置最大卡点数
export function paymentLimit(data: ModelLimit): AxiosPromise<any> {
  return request({
    url: `/api/operation/operas/configs/${data.id}/payment_limit`,
    method: "patch",
    data: data.limitObj,
  });
}
